package com.linxianqin.springbootVue.domain.convert;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.linxianqin.springbootVue.domain.dto.SysRoleDTO;
import com.linxianqin.springbootVue.domain.entity.SysRole;
import com.linxianqin.springbootVue.domain.vo.SysRoleExcel;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface SysRoleConvert {
    SysRoleConvert INSTANCE = Mappers.getMapper(SysRoleConvert.class);
    @Mappings({
            @Mapping(target = "menuIds",ignore = true),
            @Mapping(target = "deptIds",ignore = true),
    })
    SysRoleDTO entity2dto(SysRole role);
    List<SysRoleDTO> entity2dto(List<SysRole> role);
    SysRole dto2entity(SysRoleDTO roleDTO);

    @Mappings({
            @Mapping(target = "ascs",ignore = true),
            @Mapping(target = "asc",ignore = true),
            @Mapping(target = "descs",ignore = true),
            @Mapping(target = "desc",ignore = true),
    })
    Page<SysRoleDTO> entity2dto(Page<SysRole> page);

    @Mappings({
            @Mapping(target = "ascs",ignore = true),
            @Mapping(target = "asc",ignore = true),
            @Mapping(target = "descs",ignore = true),
            @Mapping(target = "desc",ignore = true),
    })
    Page<SysRole> dto2entity(Page<SysRoleDTO> page);


//    List<SysRoleExcel> entity2Excel(List<SysRole> list);
}
